/*
 * 首页产品表格
 * reSrc：标签图片
 * description：标题介绍文字
 * type：产品类型
 * homeProductDetailData：产品数据源,数组类型，第一个值为id或者包含id的对象
 * widthArray：各个列的宽度百分比
 * itemTypes：各个列的展示类型
 *
 *
 * */
'use strict';
var React = require('react');
var HomeProductMainTitle = require('../../components/pc/HkfsHomeProductTable/HomeProductMainTitle.jsx');
var HomeProductContent = require('../../components/pc/HkfsHomeProductTable/HomeProductContent.jsx');
class HkfsHomeProductTable extends React.Component {
    constructor(props) {
        super(props);
    }

    //渲染主体
    renderContent() {
        if (this.props.homeProductDetailData && this.props.homeProductDetailData.length > 0) {
            return <div className="HkfsHomeProductTable_Container">
                <HomeProductMainTitle detailHref={this.props.detailHref} reSrc={this.props.reSrc}
                                      description={this.props.description}
                                      type={this.props.type}></HomeProductMainTitle>
                <HomeProductContent data={this.props.homeProductDetailData} widthArray={this.props.widthArray}
                                    title={this.props.itemTitle} itemTypes={this.props.itemTypes}
                                    buttonText={this.props.buttonText}
                                    itemHref={this.props.itemHref}
                                    showTips={this.props.showTips}
                ></HomeProductContent>
            </div>
        }
        else {
            return <div className="HkfsHomeProductTable_Container">
                <HomeProductMainTitle detailHref={this.props.detailHref} reSrc={this.props.reSrc}
                                      description={this.props.description}
                                      type={this.props.type}></HomeProductMainTitle>
                <div className="ProductEmptyDiv HomeProductContent_Container">
                    <div className="ProductEmptyImgDiv">
                        <img src="images/pc/space_page_small.png"/>
                    </div>
                    <div className="ProductEmptyText">暂时没有产品哦</div>
                </div>
            </div>
        }
    }

    render() {
        return (
            <div>{this.renderContent()}</div>
        );
    }
}

HkfsHomeProductTable.propTypes = {
    reSrc: React.PropTypes.string.isRequired,
    description: React.PropTypes.string.isRequired,
    type: React.PropTypes.string.isRequired,
    homeProductDetailData: React.PropTypes.array.isRequired,
    widthArray: React.PropTypes.array.isRequired,
    itemTypes: React.PropTypes.array.isRequired
};

module.exports = HkfsHomeProductTable;